import 'package:cbec_app/entity/home/content/content_data.dart';

class NewZoneData extends ContentData {
  final String bgColor;
  final String titleCustomBg;
  final String showTitle;
  final String titleValue;
  final List<dynamic> subEntry; // Adjust type if needed
  final String titleType;
  final String uuid;
  final String titleDefaultBg;
  final String newZoneSource;

  NewZoneData({
    required this.bgColor,
    required this.titleCustomBg,
    required this.showTitle,
    required this.titleValue,
    required this.subEntry,
    required this.titleType,
    required this.uuid,
    required this.titleDefaultBg,
    required this.newZoneSource,
  }){
    type = 'new_zone'; // 设置 type 属性
  }

  factory NewZoneData.fromJson(Map<String, dynamic> json) {
    return NewZoneData(
      bgColor: json['bg_color'],
      titleCustomBg: json['title_custom_bg'],
      showTitle: json['show_title'],
      titleValue: json['title_value'],
      subEntry: json['sub_entry'], // Adjust parsing if needed
      titleType: json['title_type'],
      uuid: json['uuid'],
      titleDefaultBg: json['title_default_bg'],
      newZoneSource: json['new_zone_source'],
    );
  }

 @override
  ContentData fromJson(Map<String, dynamic> json) {
    return NewZoneData.fromJson(json);
  }

  @override
  Map<String, dynamic> toJson() {
    return {
      'bg_color': bgColor,
      'title_custom_bg': titleCustomBg,
      'show_title': showTitle,
      'title_value': titleValue,
      'sub_entry': subEntry,
      'type': type,
      'title_type': titleType,
      'uuid': uuid,
      'title_default_bg': titleDefaultBg,
      'new_zone_source': newZoneSource,
    };
  }

}
